package cn.yunyichina.provider.hisiface.invoke.openservice;

import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cn.yunyichina.provider.framework.dubbo.service.RegisterService;
import cn.yunyichina.provider.hisiface.invoke.IOutsideInvoke;
import cn.yunyichina.provider.iface.entity.common.Response;
import cn.yunyichina.utils.convert.JsonUtils;

import com.alibaba.fastjson.JSON;

/**
 * 医生停诊
 * 
 * @author zhou
 *
 */
public class StopRegisterService implements IOutsideInvoke {
	
	private static final Logger logger = LoggerFactory.getLogger(StopRegisterService.class);

	@Override
	public String execute(Map<String, String> params) {
		String paramsStr = JSON.toJSONString(params);
		logger.info("openService:stopRegister 接收到前置机的入参: {}", paramsStr);
		String orderList = params.get("order_list");
		if (StringUtils.isBlank(orderList)) {
			logger.error("openService:stopRegister 缺少入参 order_list");
			Response response = new Response(Response.FAILURE_CODE, "缺少入参 order_list");
			return JsonUtils.toJsonString(response);
		}
		
		String method = "yyt.register.stop.reg.out";
		Response response = RegisterService.callHumpFromInternal(method, paramsStr);
		String result = JsonUtils.toJsonString(response);
		logger.info("openService:stopRegister 接收到[{}]的返回: {}",method, result);
		logger.info("openService:stopRegister 返回给前置机: {}", result);
		
		return result;
	}

}
